package com.diaohw.module.file.controller;

import com.diaohw.module.file.service.DownloadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "文件下载")
@RestController
@RequestMapping("/download")
public class DownloadController {
    @Resource
    DownloadService downloadService;

    @Operation(summary = "根据ID下载文件")
    @GetMapping("/file/{id}")
    public void downloadByFileId(@PathVariable("id") String id) {
        downloadService.downloadByFileId(id);
    }

    @Operation(summary = "通过用户下载文件")
    @GetMapping("/account/{id}")
    public void downloadByAccount(@PathVariable("id") String id) {
        downloadService.downloadByAccount(id);
    }

}
